#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
//#define P(A,q) while(q>=0) fprintf(stderr,"%d", abs((A>>q--)%2));fprintf(stderr," = %d\n", A);q=31

int
main ()
{
	int parity1 = 0, parity2 = 0;
	int current;
	register short i = 31, pos = 0;
	int first = 0; //first number (smallest) to be printed.
	FILE *input;
	freopen ("deleted2.in", "r", stdin);
	freopen ("deleted2.out","w",stdout);

	while (scanf("%d", &current) == 1) {
		parity1 ^= current;
//		P(current,i);
	}
	while (pos < 32) {
		if (parity1 >> pos & 01)
			break;
		else
			++pos;
	}

	input = fopen("deleted2.in", "r");
	while (fscanf(input, "%d", &current) == 1) {
		if ((current >> pos) % 2 == 0) {
			parity2 ^= current;
//			P(current,i);
		}
	}
	first = parity1 ^ parity2;

	if (first < parity2)
		printf("%d %d\n", first, parity2);
	else
		printf("%d %d\n", parity2, first);

	return 0;
}
